namespace YourLastOptionsDialog.Controls
{
    /// <summary>
    /// Describes the result of a validation process.
    /// </summary>
    public class ValidationResult
    {
        private static readonly ValidationResult _success = new ValidationResult(true, null);
        
        /// <summary>
        /// Gets a validation result that represents success, i.e. a validation result that is valid and has no validation error message.
        /// </summary>
        public static ValidationResult Success
        {
            get
            {
                return _success;
            }
        }

        /// <summary>
        /// Gets or sets a value indicating whether the performed validation was successful.
        /// </summary>
        /// <value>
        ///   <c>true</c> if the validation was successful; otherwise, <c>false</c>.
        /// </value>
        public bool IsValid
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the validation error message.
        /// </summary>
        public string ValidationErrorMessage
        {
            get;
            set;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="ValidationResult"/> class.
        /// </summary>
        /// <param name="isValid">If set to <c>true</c> indicates that the validation was successful.</param>
        /// <param name="validationErrorMessage">The validation error message in case the validation failed.</param>
        public ValidationResult(bool isValid, string validationErrorMessage)
        {
            IsValid = isValid;
            ValidationErrorMessage = validationErrorMessage;
        }
    }
}